<?PHP
/*
 * $Id: barge-feed.classes.php 139 2009-12-16 15:29:56Z namba0219 $
 * =============================================================================
 * Barge - web application framework on PHP5
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * =============================================================================
 * For more information, see http://barge.googlecode.com/
 */
namespace barge\feed;

use barge\Bean;
use barge\NestedException;
use barge\System;
use barge\utils\ArrayList;
use barge\utils\String;
use barge\utils\HashMap;
use barge\httpclient\HttpClient;

/**
 * Exception for feed.
 * 
 * @version 1.0 2009/04/03
 * @since Barge 1.2.2 2009/04/03
 * @see NestedException
 */
class FeedException extends NestedException {}

/**
 * @version 1.0 2009/04/03
 * @since Barge 1.2.2 2009/04/03
 */
abstract class FeedBuilder 
{

}

/**
 * @version 1.0 2009/04/03
 * @since Barge 1.2.2 2009/04/03
 */
class Rss20FeedBuilder extends FeedBuilder
{

}

/**
 * @version 1.0 2009/04/03
 * @since Barge 1.2.2 2009/04/03
 */
class FeedLoader 
{
	/**
	 * @param $url フィードURL	
	 * @return Feed
	 * @throws FeedException 
	 */
	public static function load($url)
	{
		try {
			$client = new HttpClient();
			$response = $client->doGet($url);
//			$xml = $response->getContents();
// TODO :
		} catch (Exception $e) {
			throw new FeedException('Undefined Exception', $e);
		}
	}
}

/**
 * @version 1.0 2009/04/03
 * @since Barge 1.2.2 2009/04/03
 * @see Bean
 */
class Feed extends Bean 
{
	/**
	 * title
	 * @var string 
	 */
	private $title;
	
	/**
	 * @var ArrayList 
	 */
	private $items;

	/**
	 * @return string
	 */
	public function getTitle()
	{
		return $this->title;
	}

	/**
	 * @param string $value
	 */
	public function setTitle($value)
	{
		$this->title = $value;
	}
}

/**
 * @version 1.0 2009/04/03
 * @since Barge 1.2.2 2009/04/03
 * @see Bean
 */
class FeedItem extends Bean 
{
	/**
	 * title
	 * @var string 
	 */
	private $title;

	/**
	 * @return string
	 */
	public function getTitle()
	{
		return $this->title;
	}

	public function setTitle($value)
	{
		$this->title = $value;
	}
}


